/**
 * IBatisStorageDAO.java
 * 2009
 */
package com.weidft.dal.craft.dao.ibatis;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.weidft.dal.craft.dao.StorageDAO;
import com.weidft.dal.craft.dataobject.StorageDO;

/**
 * 
 */
public class IBatisStorageDAO extends SqlMapClientDaoSupport implements
		StorageDAO {

	private static final String INSERT = "STORAGE.insert";
	private static final String DELETE_BY_ID = "STORAGE.deleteById";
	private static final String FIND_BY_ID = "STORAGE.findById";
	private static final String UPDATE ="STORAGE.update";

	public Integer deleteById(Integer id) {
		return getSqlMapClientTemplate().delete(DELETE_BY_ID, id);
	}

	public StorageDO findById(Integer id) {
		return (StorageDO) getSqlMapClientTemplate().queryForObject(FIND_BY_ID,
				id);
	}
	public StorageDO findSimpleStorageById(Integer id) {
		return (StorageDO) getSqlMapClientTemplate().queryForObject("STORAGE.findSimpleStorageById",
				id);
	}
	public Integer insert(StorageDO storageDo) {
		return (Integer) getSqlMapClientTemplate().insert(INSERT, storageDo);
	}

	public Integer update(StorageDO storageDo) {
		return getSqlMapClientTemplate().update(UPDATE, storageDo);
	}
}
